package com.mgg.auth;

/**
 * @Author: lijun
 * @Date: 2018/9/7 10:13
 */

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @Author: lijun
 * @Date: 2018/9/6 17:00
 */
public class AuthUser extends User {

    private final String userId;

    public AuthUser(String userId, String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
        this.userId = userId;
    }

    public AuthUser(String userId, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.userId = userId;
    }

    public String getUserId() {
        return userId;
    }

    @Override
    public String toString() {
        return super.toString() + " AuthUser{" +
                "userId=" + userId +
                '}';
    }
}